import 'package:http/http.dart' as http;
import 'dart:convert';

Future getCode() async {
  final url =
      'http://192.168.0.85:8001/service/api/permission/free/security/rsa';
  final securityKey = "6ea1cf81-3b16-1c1f-f105-797def773484";
  final uri = Uri.parse(
    url,
  ).replace(queryParameters: {'securityKey': securityKey});
  final result = await http.get(uri);
  var data = jsonDecode(result.body);
  if (data['code'] == 0) {
    return data['data'];
  } else {
    throw Exception("请求失败!");
  }
}

void main() async {
  try {
    final data = await getCode();
    print(data);
  } catch (e) {
    print(e);
  }
}
